import {HTTP} from '@/utils/HTTP.js'
import {useState, useEffect} from "react";

// 异步请求频道数据
const useCommodity = () => {
    const [list, setList] = useState([])

    // console.log(res)
    useEffect(() => {

        async function getList() {
            const res = await HTTP({
                url: '/commodity/find',
                method: 'GET'
            })
            console.log(res.data)
            setList(res.data)
        }

        getList()

    }, [])

    return {list}
}

export default useCommodity